<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">入库订单ID</label>
        <div class="layui-input-block">
            <input disabled name="o_id" lay-verify="required" lay-reqtext="" placeholder="" value="${param.o_id}" class="layui-input">
            <tip>订单id不能修改。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">仓库名</label>
        <div class="layui-input-block">
            <input disabled name="stock_name" lay-verify="required" lay-reqtext="" placeholder="" value="${param.stock_name}" class="layui-input">
            <tip>仓库名不能修改。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">日期</label>
        <div class="layui-input-block">
            <input disabled name="stock_name" lay-verify="required" lay-reqtext="" placeholder="" value="${param.date}" class="layui-input">
            <tip>订单日期不能修改。</tip>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">负责人</label>
        <div class="layui-input-block">
            <input type="text" name="person" lay-verify="required" lay-reqtext="" placeholder="" value="${param.person}" class="layui-input">
            <tip>请输入需要修改的负责人。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">来源</label>
        <div class="layui-input-block">
            <input type="text" name="origin" lay-verify="required" lay-reqtext="" placeholder="" value="${param.origin}" class="layui-input">
            <tip>请输入需要修改的来源。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
    <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>

</div>
</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form','jquery','table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            $ = layui.jquery;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var index = layer.alert("负责人："+data.field.person+"<br>"+
                "来源："+data.field.origin+"<br>"
                , {
                title: '最终的提交信息'
            }, function () {

                $.post('/orderin_update',data.field,function(result) {
                    // console.log('前端输出的'+result1)
                    if(result.result){
                        layer.msg('修改成功');
                        // 关闭弹出层
                        layer.close(index);

                        var iframeIndex = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(iframeIndex);

                    }
                    else {
                        layer.msg('修改失败');
                    }
                });

            });

            return false;
        });

        table.render(

            {
            elem: '#currentTableId',
            method:'get',
            url: '/orderindet_search?o_id='+${param.o_id},
            toolbar: '#toolbarDemo',

            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {type: "checkbox", width: 50},
                {field: 'goods_id', width: 120, title: '商品ID', sort: true},
                {field: 'name', width: 160, title: '商品名'},
                {field: 'color', width: 200, title: '颜色', sort: true},
                {field: 'size', width: 80, title: '大小'},
                {field: 'amount', width: 160, title: '数量'}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: '10',
            page: true,
            skin: 'line',

        });

    });
</script>
</body>
</html>